package com.lin.reactor;

import org.reactivestreams.Subscription;
import reactor.core.publisher.BaseSubscriber;

import java.util.concurrent.TimeUnit;

/**
 * @author: linjiang
 * @date: 2025/6/22
 */
public class CustomBaseSubscribe<T> extends BaseSubscriber<T> {

    @Override
    protected void hookOnSubscribe(Subscription subscription) {
        // 一旦订阅发起无界请求
        System.out.println("开始订阅");
        subscription.request(Long.MAX_VALUE);
//        subscription.request(1);
    }

    @Override
    protected void hookOnNext(T value) {
        System.out.println("每次获取一个value: " + value);
        request(1);
    }
}
